//
//  ZJCustomerCell.m
//  这家测试项目
//
//  Created by IOS_DEVELOPER on 2017/6/7.
//  Copyright © 2017年 陈志凌. All rights reserved.
//

#import "ZJCustomerCell.h"

@implementation ZJCustomerCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    if (self.frame.size.width == 370) {
        float size = [Utils iphone6AutoScaleW:12];
        self.userName.font = [UIFont systemFontOfSize:size];
        self.houseName.font = [UIFont systemFontOfSize:size];
        self.install.font = [UIFont systemFontOfSize:size];
        self.beforeJoin.font = [UIFont systemFontOfSize:size];
        self.pay.font = [UIFont systemFontOfSize:size];
        
        float nextSize = [Utils iphone6AutoScaleW:10];
        self.sex.font = [UIFont systemFontOfSize:nextSize];
        self.needHouse.font = [UIFont systemFontOfSize:nextSize];
        
    }else if (self.frame.size.width == 320){
        float size = [Utils iphone5AutoScaleW:12];
        self.userName.font = [UIFont systemFontOfSize:size];
        self.houseName.font = [UIFont systemFontOfSize:size];
        self.install.font = [UIFont systemFontOfSize:size];
        self.beforeJoin.font = [UIFont systemFontOfSize:size];
        self.pay.font = [UIFont systemFontOfSize:size];
        
        float nextSize = [Utils iphone5AutoScaleW:10];
        self.sex.font = [UIFont systemFontOfSize:nextSize];
        self.needHouse.font = [UIFont systemFontOfSize:nextSize];
    }
    
    self.headImg.layer.masksToBounds = YES;
    self.headImg.layer.cornerRadius = 50/2;
}

-(void)setModel:(ZJCustomerModel *)model{

    _model = model;
    self.progressImg.image = [UIImage imageWithContentsOfFile:[Utils imgPath:@"tgy_icon_wd@3x.png"]];
    self.userName.text = _model.realname;
    if ([_model.gender isEqualToString:@"1"]) {
        self.sex.text = @"先生";
    }else{
        self.sex.text = @"女士";
    }
     [self.headImg sd_setImageWithURL:[NSURL URLWithString:_model.avatar?:@""] placeholderImage:[UIImage imageNamed:kDefaultImageName]];
    
    if ([_model.install doubleValue] > 0) {

        self.progressImg.image = [UIImage imageWithContentsOfFile:[Utils imgPath:@"tgy_icon_wa@3x.png"]];
    }
    if ([_model.deposit doubleValue] > 0) {

        self.progressImg.image = [UIImage imageWithContentsOfFile:[Utils imgPath:@"tgy_icon_wb@3x.png"]];
    }
    if ([_model.deal doubleValue] > 0) {

        self.progressImg.image = [UIImage imageWithContentsOfFile:[Utils imgPath:@"tgy_icon_wc@3x.png"]];
    }

}

@end
